<template>
  <div>
    <input type="text" v-model="val" />
    {{ val }}
  </div>
</template>

<script>
export default {
  computed: {
    val: {
      //给val属性赋值时触发
      set(input) {
        console.log(input);
      },
      //取val变量的值时触发
      get() {
        return "this is val";
      },
    },
  },
};
</script>

<style>
</style>